<?php 
include_once 'classes/design.php';
include_once 'classes/class.phpmailer.php';

if (isset($_REQUEST["enviar"])) {
	$msg = "Enviado em: ".date("d/m/Y - H:i")."
		
Nome: ".$_REQUEST["nome"]."
E-mail: ".$_REQUEST["email"]."
Telefone: ".$_REQUEST["telefone"]."
	
Mensagem: 
".$_REQUEST["msg"];
	
	$mail = new PHPMailer();
	
	$mail->IsSMTP();
	$mail->SMTPAuth = true;                  // enable SMTP authentication
	$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
	$mail->Host = "smtp.gmail.com";      // sets GMAIL as the SMTP server
	$mail->Port = 465;                   // set the SMTP port
	
	$mail->Username = "joaop.ribs@gmail.com";  // GMAIL username
	$mail->Password = "ssrrppjj";            // GMAIL password
	
	$mail->From = $_REQUEST["email"];
	$mail->FromName = "Contato JPRibeiro.com";
	$mail->Subject = "Mensagem enviada pelo JPRibeiro.com";
	$mail->Body = $msg; //Text Body
	
	$mail->AddReplyTo($_REQUEST["email"], "Contato JPRibeiro.com");
	
	$mail->AddAddress("joaop.ribs@gmail.com", "Joao");
	
	$enviado = $mail->Send();
}



$design = new Design();
$design->imprimir_topo();
?>

<script type="text/javascript" src="javascript/funcoes.js"></script>
<script type="text/javascript" src="javascript/validacao.js"></script>

<h1>Contact</h1>

<?php 
if (isset($_REQUEST["enviar"])) {
	if ($enviado) {
		echo "<div class=\"sucesso\">Thank you! Your message was sent succesfully!</div>";
	}
	else {
		echo "<div class=\"erro\">There was an error on sending your message: ".$mail->ErrorInfo."</div>";
	}
}
?>

You can contact me over the phone, on the number +55 (83) 8824 5687, on <a href="social.php">social networks</a>, or you can just send me a message through the form below.
<p/>
Your contact will be much much much appreciated!
<p/>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>" id="form_contact">
<input type="hidden" name="enviar" value="1" />
<table border="0" width="100%">
	<tr valign="top">
		<td width="50%">
			Your name:<br/>
			<input type="text" name="nome" style="width: 80%;" alt="Your name|Obrig"/>
			<p/>
			Your e-mail:<br/>
			<input type="text" name="email" style="width: 80%;" alt="Your e-mail|Obrig|Email" onkeyup="preencher(this, 'EMAIL', event);"/>
			<p/>
			Your phone number:<br/>
			<input type="text" name="telefone" style="width: 80%;" />
		</td>
		<td align="left">
			Your message:<br/>
			<textarea name="msg" style="width: 80%; height: 175px; resize: none;" alt="Your message|Obrig"></textarea>
		</td>
	</tr>
	<tr>
		<td colspan="2" align="center">
			<button type="submit">Send</button>
		</td>
	</tr>
</table>
</form> 

<script type="text/javascript">
iniciarForm("form_contact");
</script>

<?php 
$design->imprimir_rodape();
?>